import 'package:flutter/material.dart';

class IndexInfoItem extends StatelessWidget {

  final String title;

  final String subTitle;

  final String price;

  final String image;

  final String pkid;

  IndexInfoItem(this.title, this.subTitle,this.price, this.image, this.pkid);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 120,
      padding: const EdgeInsets.all(15),
      margin: const EdgeInsets.only(left: 10,right: 10,top: 5),
      decoration: BoxDecoration(
        color: const Color.fromRGBO(200, 200, 200, 0.5),
        borderRadius: BorderRadius.circular(10),
      ),
      child: InkWell(
        child: Row(
          children: [
            SizedBox(
              height: 70,
              width: 70,
              child: Image.network(
                  image,
                  fit: BoxFit.cover,errorBuilder: (error, stackTrace, obj) {return Image.asset("images/nvhai.png",fit: BoxFit.cover,);}),
            ),
            const SizedBox(width: 20,),
            Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(
                  width: 200,
                  child: Text(title,style: const TextStyle(fontSize: 18,fontWeight: FontWeight.w500,color: Colors.black,overflow: TextOverflow.ellipsis),),
                ),
                Text("价格：$price",style: TextStyle(fontSize: 12,fontWeight: FontWeight.bold,color: Colors.green[700],),),
                SizedBox(
                  width: 200,
                  child: Text(subTitle,overflow: TextOverflow.ellipsis,maxLines: 1,style: const TextStyle(color: Colors.black,fontSize: 12),),
                ),
              ],
            )
          ],
        ),
        onTap: (){
          Navigator.of(context).pushNamed("/project/" + pkid,arguments: {
            "name": title
          });
        },
      ),
    );
  }
}
